#include "RegAlgorithmDialog.h"
#include<QtGui/QMessageBox>

RegAlgorithmDialog::RegAlgorithmDialog(QWidget *parent/* =0 */):QDialog(parent)
{
	this->resize(330, 240);
	this->setMinimumSize(QSize(330, 240));
	this->setMaximumSize(QSize(330, 240));
	buttonBox = new QDialogButtonBox(this);
	buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
	buttonBox->setGeometry(QRect(90, 190, 161, 32));
	buttonBox->setOrientation(Qt::Horizontal);
	buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
	label_1 = new QLabel(this);
	label_1->setObjectName(QString::fromUtf8("label_1"));
	label_1->setGeometry(QRect(20, 30, 151, 20));
	lineEdit_1 = new QLineEdit(this);
	lineEdit_1->setObjectName(QString::fromUtf8("lineEdit_1"));
	lineEdit_1->setGeometry(QRect(190, 30, 113, 20));
	lineEdit_2 = new QLineEdit(this);
	lineEdit_2->setObjectName(QString::fromUtf8("lineEdit_2"));
	lineEdit_2->setGeometry(QRect(190, 60, 113, 20));
	label_2 = new QLabel(this);
	label_2->setObjectName(QString::fromUtf8("label_2"));
	label_2->setGeometry(QRect(20, 60, 151, 20));
	lineEdit_3 = new QLineEdit(this);
	lineEdit_3->setObjectName(QString::fromUtf8("lineEdit_3"));
	lineEdit_3->setGeometry(QRect(190, 90, 113, 20));
	label_3 = new QLabel(this);
	label_3->setObjectName(QString::fromUtf8("label_3"));
	label_3->setGeometry(QRect(20, 90, 151, 20));
	lineEdit_4 = new QLineEdit(this);
	lineEdit_4->setObjectName(QString::fromUtf8("lineEdit_4"));
	lineEdit_4->setGeometry(QRect(190, 120, 113, 20));
	label_4 = new QLabel(this);
	label_4->setObjectName(QString::fromUtf8("label_4"));
	label_4->setGeometry(QRect(20, 120, 151, 20));
	lineEdit_5 = new QLineEdit(this);
	lineEdit_5->setObjectName(QString::fromUtf8("lineEdit_5"));
	lineEdit_5->setGeometry(QRect(190, 150, 113, 20));
	label_5 = new QLabel(this);
	label_5->setObjectName(QString::fromUtf8("label_5"));
	label_5->setGeometry(QRect(20, 150, 151, 20));

	setWindowTitle(QApplication::translate("RegAlgorithmDialog", "Registration Parameters Setting", 0, QApplication::UnicodeUTF8));
	label_1->setText(QApplication::translate("RegAlgorithmDialog", "X Axis Translation:", 0, QApplication::UnicodeUTF8));
	label_2->setText(QApplication::translate("RegAlgorithmDialog", "Y Axis Translation:", 0, QApplication::UnicodeUTF8));
	label_3->setText(QApplication::translate("RegAlgorithmDialog", "Rotation Center X:", 0, QApplication::UnicodeUTF8));
	label_4->setText(QApplication::translate("RegAlgorithmDialog", "Rotation Center Y:", 0, QApplication::UnicodeUTF8));
	label_5->setText(QApplication::translate("RegAlgorithmDialog", "Rotation Angle:", 0, QApplication::UnicodeUTF8));
	isOKButtonClicked=false;
	QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(OKButtonClicked()));
	QObject::connect(buttonBox, SIGNAL(rejected()), this, SLOT(CancelButtonClicked()));

}
RegAlgorithmDialog::~RegAlgorithmDialog()
{

}
void RegAlgorithmDialog::OKButtonClicked()
{
	while(lineEdit_1->text()==NULL||lineEdit_2->text()==NULL||lineEdit_3->text()==NULL||lineEdit_4->text()==NULL||lineEdit_5->text()==NULL)
	{
		QMessageBox::about(0,"ERROR!","The blanks must be filled all!");
		return;
	}
	allParameters=lineEdit_1->text();
	allParameters+=QString(" ")+lineEdit_2->text();
	allParameters+=QString(" ")+lineEdit_3->text();
	allParameters+=QString(" ")+lineEdit_4->text();
	allParameters+=QString(" ")+lineEdit_5->text();
	isOKButtonClicked=true;
	accept();
}
void RegAlgorithmDialog::CancelButtonClicked()
{
	isOKButtonClicked=false;
	reject();
}